<template>
   <div>
    <el-form :inline="true" :model="query" label-width="130px" size="small">
      <!-- 申请商城账号查询 -->
      <el-form-item class="query-form-item">
            <el-input v-model="query.company" placeholder="商城公司名称" prefix-icon="el-icon-search"  @keyup.enter.native="onSubmit" clearable></el-input>
      </el-form-item>
      <!-- 查询框 -->
      <el-form-item>
        <el-button type="primary" icon="el-icon-refresh" @click="onRest" size="small"></el-button>
        <el-button type="primary" icon="el-icon-search" @click="onSubmit" size="small">搜索</el-button>
      </el-form-item>
      </el-form >
      <!-- table表单 -->
      <el-table  ref="singleTable" :data="tableData" v-loading="loading"   style="width: 100%">
        <el-table-column label="序号" type="index" align="center" width="50">  </el-table-column>
        
        <el-table-column prop="userid" align="center" label="商城id" ></el-table-column>
        <el-table-column prop="usermobile" align="center" label="商城手机号" ></el-table-column>
       
        <el-table-column prop="enterprisename"  align="center" label="商城公司名称" ></el-table-column>

        <el-table-column  prop="registrationnumber" align="center" label="社会统一信用码"  > </el-table-column>
        <el-table-column label="操作" align="center">
                <template slot-scope="scope">
                    <el-button type="primary"  @click.native="addForm(scope.row)" size="small">新增到商城孵化申请</el-button>
                </template>
            </el-table-column>
    </el-table>
    <el-pagination class="pagination-container"  background  :page-size="query.pageSize"
    @size-change="handleSizeChange" @current-change="handleCurrentChange"  layout="total,sizes,prev, pager, next, jumper"
    :current-page="this.query.currentPage"
    :page-sizes="[10, 20, 30, 50]"
    :total="totalNumber"></el-pagination>
    </div>
    
</template>
<script>
 
  import {getEntity } from "../../api/incubationrules/index.js";
  export default {
    data() {
      return {
        tableData: [],//列表集合
        query: {
          currentPage: 1,
          pageSize: 10  ,
          company:""//商城公司名称
        },
        totalNumber: 0,
        loading: false,
        dataList:[],
        formLabelWidth: '120px'
      }
    },
    methods: {
      // 列表数据获取
      getEntity(){
         this.loading = true;
        getEntity(this.query)
        .then(data=>{
            console.log(data) 
            if (data.code != 0) {
                this.$message.error(response.message);
                this.loading = false;
                return false;
            }
            this.tableData=data.data.list || []
            this.totalNumber = data.data.totalNumber || 0;
            // console.log(this.tableData)
            setTimeout(() => {
             this.loading = false;
            }, 0.3 * 1000);
          })
          .catch(err=>{
             this.loading = false;
              this.tableData =[]
          })
      },
      //查询商城页面跳转
    //   handlerPage(){
    //     this.$router.push({path:"searchEntity"})
    //   },

    //新增到上个设置页面
    addForm(val){ 
      console.log(val)
      this.$router.push({
          path:"addEntity",
          query:{data:val}
      })
    },
     
      //刷新
      onRest() {
            this.query = {
                currentPage: 1,
                pageSize: 10  ,
                company:""
            };
           this.getEntity()
        },
      //查询
      onSubmit() {
        this.query.currentPage = 1;
        this.getEntity()
      }, 
      handleCurrentChange(val) {
        this.query.currentPage = val;
        this.getEntity()
      },
      handleSizeChange(val) {
        this.query.pageSize = val;
        this.getEntity()
     },
    },
   
    mounted(){
      
    },
   created(){
     this.getEntity()
   }

  }
</script>


